/**
 * @Author: 焦质晔
 * @Date: 2019/6/20
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2019-11-05 14:45:58
 */
import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';

// 获取角色列表
export const getRoleList = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles`, { params });
// 新增角色

export const addRole = params => axios.post(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles`, params, { mark: types.YAN_ROLE_ADD });
// 删除角色
export const deleteRole = (id) => axios.delete(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/deleteById/${id}`, { id: Number(id) });
// 获取功能树
export const getMenu = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/roleData`, { params });

export const roleData = (id) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/roleData/${id}`);
// 个人参数配置
// 获取维修参数配置列表
//  export const getMaintain = (roleId) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/roleMaintain/${roleId}`);
export const getMaintain = (roleId) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/findRoleByParts/${roleId}`);
// 获取配件参数配置列表
export const getAccessories = (roleId) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/roleAccessories/${roleId}`)
// export const getAccessories = (roleId) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/findRoleByParts/${roleId}`)
// 获取配件库参数配置列表
export const getPartAccessories = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/store/pjck/accessories/powerChecks`, { params })
export const findStorageCode = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partStocks/findStorageCode`, { params })

// 获取配件库参数配置列表
export const getJpckAccessories = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/store/jpck/accessories/powerChecks`, { params })

// 获取优惠模式库参数配置列表
export const getDiscountMode = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/discountmodes/discountMode/permissionDicts`, { params })


// 获取菜单信息操作权限
export const getRoleMenuRange = (menuId, roleIds) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/roleMenuRange/${menuId}/${roleIds}`)
// 获取菜单信息操作按钮
export const getRoleMenuAction = (menuId, roleIds) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/roleMenuAction/${menuId}/${roleIds}`)
// 分配角色权限
export const setRoleAuth = (id, params) => axios.put(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/permission`, params)
//获取登陆职位CODE
export const getUserByIdCMSNew = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getUserByIdCMSNew`, {
  params
})
//获取角色
export const findTcCodeByType = (id) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/findRoleByType/${id}`)

//获取整车仓库参数配置列表getVehicleWarehouse
// export const getVehicleWarehouse = (roleId) => axios.get(`${SERVER.CYXDMS_VEHICLE}/vsStore?limit=100&pageNum=1`)
export const getVehicleWarehouse = {}
//维修类型
export const findAllRepairType = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedataRepairtypes/findAllRepairType`)
// 获取优惠模式
// export const getqueryDiscountMode = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairEstimate/queryDiscountMode`, { params });

export const getQueryDiscountMode = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/discountmodes/queryDiscountMode`, {
  params
})

// 获取仓库
export const getAllWarehouse = params => axios.get(`${SERVER.CLAIMFAC}/rPReturnWh/getAllWarehouse`, {
  params
})
